import java.util.*;

/**
 * @Author admin
 * @Date 2019/3/29 8:31
 */
public class Test1 {
    public static void main(String[] args) {
        System.out.println("请输入裁判人数");
        Scanner sc=new Scanner(System.in);
        int sr=sc.nextInt();
        ArrayList arrayList=new ArrayList();
        System.out.println("请输入各个裁判的分数（以回车结束）：");
        for (int i = 0; i <sr ; i++) {
            int sr2=sc.nextInt();
            arrayList.add(sr2);
        }
        Iterator iterator =arrayList.iterator();
        while (iterator.hasNext()){
            System.out.println(iterator.next());
        }
        Collections.sort(arrayList);
        System.out.println("去掉一个最高分"+arrayList.get(arrayList.size()-1));
        System.out.println("去掉一个最低分"+arrayList.get(0));
        arrayList.remove(0);
        arrayList.remove(arrayList.size()-1);
        int result=0;
        for (int i = 0; i <arrayList.size() ; i++) {
            int a=(int)arrayList.get(i);
            result=result+a;

        }
        System.out.println("选手最后得分"+(result/arrayList.size()));
    }
}
